package ipsite.spotcheck;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;

import java.net.URL;
import java.nio.charset.Charset;

public class SpotCheck {
	public static String Check(String name,String url) throws IOException
	{
		String time = "0";
		
		URL dataURL = new URL(url+"?name="+name);			
		String charset   = "UTF-8";			
					
	    HttpURLConnection connection = (HttpURLConnection) dataURL.openConnection();
	    connection.setInstanceFollowRedirects(true);
	    BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), Charset.forName(charset)));
		String content = "";
		
		while(1==1)
		{
			String str = reader.readLine();
			if(str==null) break;
			content+=str;
			
		}
		if(content != "")
		{
			time = content;
		}
		return time;
	}
}
